﻿
@{
    ViewBag.Title = "DocGuanLiYuan";
    Layout = "~/Views/Shared/DocInfos.cshtml";
    
   
}
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>GetHospitalAdmin</title>
    <link href="/content/bootstrap.min.css" rel="stylesheet">
    <link href="/content/mono.admin.css" rel="stylesheet">

    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <script src="/Scripts/jquery-3.1.0.min.js"></script>
    <script src="/Scripts/bootstrap.min.js"></script>
    <script src="/Asset/layer/layer.js"></script>
    <link id="layui_layer_skinlayercss" href="http://123.57.71.187/Asset/layer/skin/layer.css" rel="stylesheet">

    <link href="/Asset/font-awesome-4.6.3/css/font-awesome.min.css" rel="stylesheet">
    <script src="/Asset/esimakin-twbs-pagination/jquery.twbsPagination.min.js"></script>

</head>
<h2>DocGuanLiYuan</h2>

<div class="col-md-10" style="margin-left:150px;margin-right:150px;">
    <div class="page-header clearfix" style="padding: 10px;">
        <h4 class="pull-left">医院管理员列表</h4>
        <!--操作按钮-->
        <div class="pull-right">
            <a class="btn btn-success btn-sm" data-toggle="modal" onclick="add()" data-target="#modal_add_user">添加医院管理员</a>
        </div>
    </div>
    <!--内容区域-->
    
    <table class="table table-striped table-hover" id="t1" data-search-form="#user-search-form">
        <thead>
            <tr>
                <td>编号</td>
                <td>用户名</td>
                <td>密码</td>
                <td>医院名称</td>
                <td>操作</td>
            </tr>

        </thead>
        
       
        @*<tbody id="mytbody"><tr><td>20</td><td>admin123</td><td>admin123</td><td>河北省胸科医院体检中心</td> <td style="width: 10%;"><div class="btn-group"><a class="btn btn-default btn-sm" href="#">管理</a> <a class="btn btn-default btn-sm dropdown-toggle" aria-expanded="false" href="#" type="button" data-toggle="dropdown"><span class="caret"></span> </a><ul class="dropdown-menu"><li><a class="hospital_edit" onclick="ShowEdit(20)" href="#" data-id="20">编辑</a></li><li><a onclick="Dele_show(20)" href="#">删除</a></li> </ul></div></td></tr></tbody>*@
       
    </table>


    <div tabindex="-1" class="modal fade in" id="modal_add_user" role="dialog" aria-labelledby="label_course" style="display:none;">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" aria-label="Close" type="button" data-dismiss="modal">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h4 class="modal-title" id="label_course"><strong>添加医院管理员</strong></h4>
                </div>
                <form method="post" action="/DocInfos/DocGuanLiYuanAdd">


                    <div class="modal-body">
                        <div class="row form-group">
                            <div class="col-md-3 control-label">
                                <label class="pull-right" for="Name">用户名</label>
                            </div>

                            <div class="col-md-7 controls">
                                <input class="form-control" id="Name" name="name" type="text">
                            </div>
                        </div>

                        <div class="row form-group">
                            <div class="col-md-3 control-label">
                                <label class="pull-right" for="Address">密码</label>
                            </div>
                            <div class="col-md-7 controls">
                                <input class="form-control" id="Password" name="pwd" type="password">
                            </div>
                        </div>
                        <div class="row form-group">
                            <div class="col-md-3 control-label">
                                <label class="pull-right" for="Grade">所属医院</label>
                            </div>
                            <div class="col-md-7 controls">
                                <select class="form-control" id="select_show"> <option value="1">河北省胸科医院体检中心</option> <option value="2">石家庄市第一医院体检中心</option> <option value="18">河北省直机关体检中心</option> <option value="26">河北医科大学第一医院体检中心</option> <option value="27">河北以岭医院体检中心</option> <option value="28">石家庄市职业病防治院</option> <option value="29">河北省中医院体检中心</option> <option value="30">河北省老年病医院</option></select>
                            </div>
                        </div>
                    </div>

                    <div class="modal-footer">
                        <div id="doing" style="float: left; display: none;">
                            <i class="fa fa-circle-o-notch fa-spin"></i><span> 处理中...</span>
                        </div>
                        <div id="success" style="float: left; display: none;">
                            ]
                            <i class="fa fa-check-square"></i><span> 保存成功！</span>
                        </div>
                        <div id="error" style="float: left; display: none;">
                            <i class="fa fa-warning"></i><span> 保存失败！</span>
                        </div>
                        <button class="btn btn-default" type="button" data-dismiss="modal">关闭</button>
                        <button class="btn btn-primary" id="btn_add_hospital" type="submit">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    

    <div tabindex="-1" class="modal fade in" id="modal_add_user1" role="dialog" aria-labelledby="label_course" style="display:none;">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button class="close" aria-label="Close" type="button" data-dismiss="modal">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h4 class="modal-title" id="label_course"><strong>修改医院管理员</strong></h4>
                </div>
                <form method="post" id="laolao" action="/DocInfos/DocGuanLiYuanUpt2">


                   
                </form>
            </div>
        </div>
    </div>

   
   
    <!--分页-->
    <nav class=" text-center">
        <ul class="pagination-sm" id="pagination"></ul>
    </nav>
</div>

<script>

    $(function () {

        $.ajax({
            type: "post",
            dataType: "json",
            url: "/DocInfos/DocGuanLiYuanshow",
            success:function(obj)
            {
                for(var i =0;i<obj.length;i++)
                {
                    $("#t1").append("<tbody><td>" + obj[i].T_DOC_ID + "</td><td>" + obj[i].T_DOC_UserName + "</td><td>" + obj[i].T_DOC_UserPwd + "</td><td>河北省胸科医院体检中心</td> <td style='width: 10%;'><div class='btn-group'> <button class='btn btn-primary' type='button' onclick='del(" + obj[i].T_DOC_ID + ")'>删除</button>&nbsp; <button class='btn btn-primary' type='button' onclick='upt(" + obj[i].T_DOC_ID + ")'>编辑</button></div></td></tr></tbody>")
                }
            }


        })


    })
    function guna()
    {
        $("#modal_add_user1").css("display", "none");
    }
    function add()
    {
        $("#modal_add_user").css("display", "block");
    }
    function del(id)
    {
        
        location.href = "/DocInfos/DocGuanLiYuanDel?id=" + id;
        

    }
    function upt(id)
    {
        
        alert(2)
        $("#modal_add_user1").css("display", "block");
        $.ajax({
            type: "post",
            dataType: "json",
            data:{id:id},
            url: "/DocInfos/DocGuanLiYuanUpt1",
            success:function(obj)
            {
               
                for (var i = 0; i < obj.length; i++)
                {
                    $("#laolao").append(" <div class='modal-body'><div class='row form-group'><div class='col-md-3 control-label'><label class='pull-right' for='Name'>ID</label> </div><div class='col-md-7 controls'><input class='form-control' id='tt2'' readonly='true' value='" + obj[i].T_DOC_ID + "' name='id' type='text'></div> <div class='modal-body'><div class='row form-group'><div class='col-md-3 control-label'><label class='pull-right' for='Name'>用户名</label> </div><div class='col-md-7 controls'><input class='form-control' id='tt2'' value='" + obj[i].T_DOC_UserName + "' name='name' type='text'></div></div> <div class='row form-group'><div class='col-md-3 control-label'><label class='pull-right' for='Address'>密码</label></div><div class='col-md-7 controls'><input class='form-control' value='" + obj[i].T_DOC_UserPwd + "' id='tt3' name='pwd' type='password'></div></div><div class='row form-group'><div class='col-md-3 control-label'><label class='pull-right' for='Grade'>所属医院</label></div><div class='col-md-7 controls'><select class='form-control' id='select_show'> <option value='1'>河北省胸科医院体检中心</option> <option value='2'>石家庄市第一医院体检中心</option> <option value='18'>河北省直机关体检中心</option> <option value='26'>河北医科大学第一医院体检中心</option> <option value='27'>河北以岭医院体检中心</option> <option value='28'>石家庄市职业病防治院</option> <option value='29'>河北省中医院体检中心</option> <option value='30'>河北省老年病医院</option></select></div></div></div><div class='modal-footer'><div id='doing'style='float: left; display: none;'><i class='fa fa-circle-o-notch fa-spin'></i><span> 处理中...</span></div><div id='success' style='float: left; display: none;'>]<i class='fa fa-check-square'></i><span> 保存成功！</span></div><div id='error' style='float: left; display: none;'><i class='fa fa-warning'></i><span> 保存失败！</span></div><button class='btn btn-default' type='button' data-dismiss='modal' onclick='guan()'>关闭</button><button class='btn btn-primary' id='btn_add_hospital' type='submit'>提交</button></div>");
                }
                 

                    //$("#t5").val() = obj[0].T_DOC_ID;
                    //$("#tt2").val() = obj[0].T_DOC_UserName;
                    //$("#tt3").val() = obj[0].T_DOC_UserPwd;
                
            }


        })
    }

   
</script>
